DEFINITION MODULE Terminal;

(* (C) Copyright 1987,1988 Fitted Software Tools. All rights reserved. *)

(*
    All the actual I/O is performed by invoking a procedure from TermBase.

    The client module may redirect the terminal I/O by using the procedures
    provided for that effect in TermBase.
*)


PROCEDURE KeyPressed() :BOOLEAN;
(*
    is there any input available?
*)

PROCEDURE Read( VAR ch :CHAR );
(*
    return the next input character using TermBase.Read
*)

PROCEDURE ReadLine( VAR string :ARRAY OF CHAR );
(*
    read a whole line (using Read), echoing the characters read except for
    the terminating character (EOL or ESC).

    ASCII.BS will cause the last character read to be deleted.
    ASCII.DEL will cause all characters read to be deleted.
    ASCII.ESC will cause all characters read to be deleted and the input
              is terminated.

    ReadAgain followed by Read can be used to get the terminating character
    (EOL or ESC).
*)

PROCEDURE ReadAgain;
(*
    force the next call to Read to return the last character read again
*)

PROCEDURE Write( ch :CHAR );
(*
    write ch through TermBase.Write
*)

PROCEDURE WriteString( string :ARRAY OF CHAR );
(*
    write the string using Write.
*)

PROCEDURE WriteLn;
(*
    same as: Write( ASCII.EOL )
*)

PROCEDURE WriteLine( string :ARRAY OF CHAR );
(*
    same as: WriteString( string ); WriteLn;
*)

PROCEDURE ClrScreen;
(*
    same as: Write( ASCII.FF )
*)

PROCEDURE Goto( line, pos :CARDINAL );
(*
    TermBase.Goto( line, pos )
*)

END Terminal.